from django.urls import path, include
from rest_framework.routers import DefaultRouter
from . import views

router = DefaultRouter()
router.register('cities', views.CityViewSet)  # 注意注册所有视图集
router.register('idcs', views.DataCenterViewSet)
router.register('hosts', views.HostViewSet)

urlpatterns = [
    path('', include(router.urls)),
    # 确保ping端点存在
    path('hosts/<int:pk>/ping/', views.HostViewSet.as_view({'get': 'ping'}))
]